package com.jiaai.filter.aop;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletRequest;

/**
 * class_name:BackPermissionAspect
 * describe:------------------>后台管理员权限切面类
 * create_user:张昉平
 * create_date:2018/2/28
 * create_time:11:38
 */
@Aspect
@Component
public class BackPermissionAspect {

    @Autowired
    private HttpServletRequest request;

    @Around("@annotation(permission)")
    public Object around(ProceedingJoinPoint pjp, BackPermission permission) throws Throwable {
        String auths = request.getAttribute("auths").toString();
        int index = permission.index();
        System.out.println(auths);
        return pjp.proceed();
    }
}
